import en from './lang/en.js'
import tc from './lang/tc.js'


/**
 * 这个是扩展函数，请写你自定义的函数
 */

//是否是区块链浏览器
const isDapp = () => {
	if (typeof web3 === "undefined") {
		return false;
	} else {
		return true;
	}
}

const backPage = () => {
	uni.navigateBack();
}

function getLanguage() {
	let lang = uni.getStorageSync('_language') || 'tc';
	return lang;
}

function yy(code) {
	let key = getLanguage();
	// console.log(key);
	let arr = {
		"en": en,
		"tc": tc,
	};
	if (arr[key][code]) return arr[key][code];
	return code;
}

module.exports = {
	isDapp,
	backPage,
	lang: yy,
	getLang: getLanguage
}